using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace _2021_6_21
{
    public partial class Chatting : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Account"] == null || Response.Cookies["Pass"] == null)
            {
                Response.Redirect("login.aspx");
            }
            if (Application["chat"] == null)
            {
                Application["chat"] = new Panel();
            }

            chat.Controls.Add((Panel)Application["chat"]);
        }

        protected void Send(object sender, EventArgs e)
        {
            string time = DateTime.Now.ToString();
            string name = Session["Account"].ToString();

            Literal literal = new Literal();
            literal.Text =  time +"  " + name + ":" + message.Text + "<br/>";
            ((Panel)Application["chat"]).Controls.Add(literal);

            message.Text = "";

        }

        protected void Quite(object sender, EventArgs e)
        {
            Session.Abandon();
            Response.Redirect("WebForm2.aspx");
        }
    }
}